﻿using AiShow.BLL;
using AiShow.Commen.Vod;
using AiShow.IBLL;
using AiShow.Model;
using AiShow.WebSite;
using System;
using System.Web.UI;

namespace AiXiu.WebSite
{
    /// <summary>
    /// 视频播放页
    /// </summary>
    public partial class Play : Page
    {
        public string VideoId;
        public int UserId;
        public TBVideos Video;
        public TBUsers Author;
        public GetPlayInfoResult playInfo;
        public bool IsLike;
        public long LikeCount;
        public long DiscussCount;

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                this.VideoId = Request.QueryString["id"];
                TBUsers user = IdentityManager.ReadUser();
                this.UserId = user.Id;
                // 获取发布者信息
                IVideoManager videoManager = new VideoManager();
                this.Video = videoManager.GetVideoByVideoId(this.VideoId).ReadResult();
                this.Author = Video.TBUsers;
                // 获取播放地址
                this.playInfo = videoManager.InitPlay(this.VideoId).ReadResult();
                //// 点赞
                //ILikeManager likeManager = new LikeManager();
                //this.IsLike = likeManager.IsLike(VideoId, UserId);
                //this.LikeCount = likeManager.Count(VideoId);
                //// 评论
                //IDiscussManager discussManager = new DiscussManager();
                //this.discusscount = discussmanager.count(videoid);
            }
        }
    }
}